Can't Delete Folder, "Destination Path Too Long" Error in Windows 7
I've seen other similar posts, but none of them provides an actual solution that has worked for this ridiculous problem I'm having. I'm simply trying to delete a folder from my backup drive in Windows 7, but Windows shows the error, "Destination Path Too Long: The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path. " as shown here: Then, after I "Skip" this item, I get another similar error, but this time it says, "Source Path Too Long: The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation. " as shown here: So, I deleted all sub folders and files in an attempt to work around this problem. There is one folder, that is actually completely empty, that refuses to be deleted. I moved this folder to the root of my drive, I even tried renaming it, but it never gets deleted. Seriously, I just want to delete this folder. I've tried third-party utilities, checked the disk for errors, tried deleting the folder from the command line, and nothing has been able to delete this folder. It seems like a cutting-edge operating system should be able to handle a simple delete operation without so much trouble. Brian Hall www.bhall.com
December 2nd, 2009 4:47am

Can you list the full path to the file? Based on what you posted above it looks as though it's only 180 characters, but it's hard to be sure.How is your backup drive formatted? Is it NTFS or FAT32? Properties on the drive in the My Computer Explorer window should tell you.You may want to reformat it to NTFS if it's the latter. I believe NTFS allows longer path names. NTFS is also more reliable and secure.-Noel
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2009 4:54am

Thanks for the reply. My backup drive is formatted NTFS, and the path to the folder I'm trying to delete is D:\Local. I renamed it to D:\Can'tDelete, but it still won't delete. The folder size is around 17 GB, but there are no files at all in the folder! The funny thing is that when I attempt to delete it, it says there are items in the folder as shown in the above error messages. I can reproduce this error by copying the folder C:\User\Username \AppData\Local\. This is the folder that won't get deleted. The strange thing is, it was copied from a Robocopy script to the backup drive, and I am able to completely delete all of the contents of the folder. However, no matter when I move this folder to or what I do to it, I am always unable to delete this folder. It's very strange. Brian Hall www.bhall.com
December 2nd, 2009 5:41am

How do you put files on this backup drive? Are you using Windows Backup? If so, I've not found documentation on just how it organizes its files, but it's not inconceivable it is using long machine-generated names and folders.In any case, it sounds like there are hidden files there. In Explorer, Tools - Folder Options - View tab, click "Show hidden files", and also uncheck "[ ] Hide protected operating system files". I'm guessing there's a REALLY hugely deep folder in there somehow, and these settings could help you see it. You probably won't want to leave these settings enabled permanently.By the way, a nifty freewaretool for visualizing what folders have large files or collections of files in them is Scanner by Steffen Gerlach:http://www.steffengerlach.de/freeware/-Noel
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2009 7:46am

The folder that I cannot delete was put there using a Robocopy script (using the /MIR command-line switch) that synchronizes my Windows profile. I showed the protected operating system files and saw that there are many copies of Application Data within itself (consuming a massive amount of storage). It seemed to go on literally forever, and as I navigated down the Application Data folders, the system got a little sluggish and weird. Here is a screen shot of only a handful: I drilled down many layers, and periodically moved the Application Data folder to the root of the D:\ and deleted it. Sometimes it would delete after a minute or two, and sometimes, it would show the same "Path too long" error as shown previously. However, I did receive this curious error while attempting to delete one of the sub folders: I've tried WinDirStat which I think is similar to Scanner, that also shows a graphical representation of the folders and disk space consumption. Unfortunately, it wasn't able to delete the files. At the moment, I'm still flailing around trying to strategically move and delete folders and sub folders, but I'm starting to get tired. This is like a bad nightmare.Brian Hall www.bhall.com
December 2nd, 2009 8:41am

I did notice that within C:\Users\UserName \AppData\Local\ there is a shortcut called Application Data . This appears to be the default for all Windows 7 user accounts. Perhaps Robocopy is copying not just the shortcut.lnk file, but the actual destination and its contents and doing this over and over until the disk fills up (which is what my last few Robocopy scripts have been doing). If you're curious, my Robocopy script simply does the following: robocopy "C:\Users\UserName" "D:\Nightly\UserName" /MIR /R:3 /W:5 /NP /TEE /LOG+:"C:\Users\UserName\Desktop\BackupLog.txt" I'm still unable to delete the folder.Brian Hall www.bhall.com
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2009 8:52am

Hm, I wouldn't expect to see many copies of folders with the same name...I think I'd do a CHKDSK D: next and see whether there's anyfile system corruption there.-Noel
December 2nd, 2009 8:55am

CHKDSK returned no errors on drive D:Brian Hall www.bhall.com
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2009 8:56am

I finally deleted all of the folders by drilling down to the almost endless copies of Application Data and moving subsequent levels to the root of the D:\ and deleting piece by piece. I have no idea how those copies were made in the first place, and secondly, why Windows makes it so hard to delete such a nasty, unwieldy folder structure. Ugh!Brian Hall www.bhall.com
December 2nd, 2009 9:03am

Brain, Could be that the robocopy script causes the recursion in the target directory tree because of junction points in the source. I'm pretty sure the windows \User directory tree has junctions that could create this situation. You may wish to try adding the "/XJ" option to the robocopy command so that it doesn't follow junctions.
Free Windows Admin Tool Kit Click here and download it now
December 25th, 2009 11:09pm

Brain,Could be that the robocopy script causes the recursion in the target directory tree because of junction points in the source. I'm pretty sure the windows \User directory tree has junctions that could create this situation. You may wish to try adding the "/XJ" option to the robocopy command so that it doesn't follow junctions. It would appear the issue is a length limitation in the folder structure. I created 2 batch files in order to resolve the issue quickly. the /XJ option should prevent the issue in future. After running trial.cmd you can delete from the top level folder without errors. The messy part is that you must "end task" on the command window in order to stop the infinite loop. Control C does not work. In my scenario there were 2 more folders with the same problem 5 or 10 levels down from the 1st "Application Data" that I manually renamed as well. Until the tree length is short enough Windows was too unstable to find the last 2 anomolies manually. Prompt:\copy con trial.cmd ren "Application Data" a Prompt:\cd a Prompt:\trial2.cmd ^Z Prompt:\copy trial.cmd trial2.cmd Prompt:\edit trial2.cmd ren "Application Data" a Prompt:\cd a Prompt:\trial.cmd Save and exit.
March 23rd, 2010 8:19am

Thank you so much for the great responses, especially the "/XJ" option in Robocopy to prevent the following of junction points!Brian Hall www.bhall.com
Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2010 7:02pm

Hi all. I was having the same exact problem, for the same exact reason--robocopy was following the junction "Application Data" and creating what seemed like an infinite number of folder copies. My solution was to delete the offending folder from within Cygwin using a standard unix delete command: `rm -rf foldername'. Worked like a charm! Thanks, hs
May 25th, 2010 7:21am

Thanks for the Cygwin tip. I was going crazy. This did it in no time flat.
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2010 8:18am

I use vista but this was the only post online I could find which involved this error. I had exactly the same one - I eventually ended up renaming every sub-folder with one letter (I went through the alphabet) and just kept renaming and attempting deletion until it eventually gave in. It took a long while but I was victorious - This saves downloading any software or messing with boot commands and things. Just thought I'd put it here for anyone else who stumbles upon this silly problem. Lorraine
July 8th, 2010 1:06am

This is all great - if your a programmer? I'm just a stupid user so would you mind giving me a step-by-step on how to execute this copmmand from the start button? It blows me away that MS would even allow thier new OS to operate like this without giving an end-user the ability to delete a file that was placed in "windows.old" when a fresh copy of the OS OS was installed. ANything you can do to help would be appreciated; the offending file was left on my C:\Windows.old\Users\Steven E. Gilbert\Desktop Apparently it won't let me change its protection from read only either. Thanks, S
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2010 7:20pm

I have this issue too. NOTE THAT THIS IS JUST YET ANOTHER BUGGY BUGGY WIN7 PROBLEM. This is an exploit I plan to publish: You can create directories programatically that the os can not delete! Great for malware!!!. Thanks Steve! You are doing a great job!
July 24th, 2010 9:01pm

Jim D_ This is not a new problem and it is not confined to build 7600, or for that matter the OS at all, but rather a limitation that is clearly documented in the all NTFS specifications, including the latest NTFS revisions. Your statement about malware is way off target and represents that you do not have a sufficient understanding of computer file systems, file system forensics or engineering and would be woefully unqualified to publish anything about it. It's easy to say this is a bug, or a exploitable aspect--but if they planned that you can only have paths of certain lengths and files names of certain lengths (remember a directory is just a file name itself), that isn't a bug because it was expected and designed that way. What would your limit be? Something double? There you would run into problems as the MFT entries, B-trees, index nodes, (just to name a few) etc. would all have to be totally revamped resulting in a huge expenditure of resources so you can put a folder in a folder in a folder in a folder in a folder in a folder ad infinitum then have an overly descriptive filename...?!? Get a book, and make a concerted effort to understand why things were done a certain way. The malware comment...the directories can be deleted, it just might take clever programmers who have to write applications to help those of you who can't figure this simple on out. If all else fails, edit the MFT and any non-resident attributes for the file name. If this was a the big problem we faced with malware, the problem of malicious code would be solved by 22:00 EDT today. I beg you to pardon the cliche, but this isn't rocket science. Respectfully, J. C.
Free Windows Admin Tool Kit Click here and download it now
August 21st, 2010 10:00pm

I tried to download and install Cygwin but it was up to several GB so I cancelled it. There didn't appear to be anything there I could run. I need to get rid of the folder on my external backup drive. Yes, it was created by a ROBOCOPY backup of a user folder. The nested folders are hidden, and the hidden attribute cannot be removed. The files cannot be renamed as they do not "exist". In a command window, I can view all this using but everything results in an error. > dir H:\USERS_PAT\AppData\Local\ /s /on The directory name H:\USER_PAT\AppData\Local\Application Data\Application Data \Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Applic ation Data\Application Data\Application Data is too long.
August 24th, 2010 5:18am

I finally deleted all of the folders by drilling down to the almost endless copies of Application Data and moving subsequent levels to the root of the D:\ and deleting piece by piece. I have no idea how those copies were made in the first place, and secondly, why Windows makes it so hard to delete such a nasty, unwieldy folder structure. Ugh! Brian Hall www.bhall.com next time it happens try this At a command prompt with elevated level (Start -> type cmd -> rightclick cmd > run as administrator) try the following: cacls D:\Foldername /T /G Everyone:F rmdir /s /q D:\Foldername This command should delete any folder whatsoever ceasar, CES Free Tech Help
Free Windows Admin Tool Kit Click here and download it now
September 17th, 2010 3:38am

J.C. This is not a new problem and it is not confined to build 7600, or for that matter the OS at all, but rather a limitation that is clearly documented in the all NTFS specifications, including the latest NTFS revisions. J.C., it is an OS limitation and NOT a ntfs limitation, an amazingly stupid one if you ask me, but could be for backwards compatibility, have a bit of a read of the info below for more technical information, but the basic issue is all windows API's including 7 are limited to 256 character path's, ntfs can support up to 32767 characters long, which is very long!! You can purchase, not sure about freeware, filemanagers that do not have this limitation... Edit: you can use richcopy to copy to a different location, then delete, not perfect but easier... http://technet.microsoft.com/en-gb/magazine/2009.04.utilityspotlight.aspx Unfortunately this time you can’t blame the kernel, but you can blame the windows API's, even in Win7 I believe, I am guessing this is for backwards compatibility. From WIKI – NTFS File names are limited to 255 UTF-16 code words. Certain names are reserved in the volume root directory and cannot be used for files. The NT kernel limits full paths to 32,767 UTF-16 code words. Have a look at this link, it does show you how to access long path, by typing "\\?\D:\<very long path>" http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx Regards Andrew
October 19th, 2010 7:44am

LONG PATH Tool provides a powerful and highly versatile solution to copy and delete files and folders with long paths. You can test out a fully functional version- free trial. http://www.longpathtool.com/index.html
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2010 7:37pm

Hy. I ran into that damn problem too. And after days of searching I finally found this software: Long Path Tool. It's GREAT. You can find it here: http://www.longpathtool.com/ Regards.
November 3rd, 2010 6:51pm

I had the same problem. And www.pathtoolongtool.com helped me.
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2010 8:09pm

I've seen other similar posts, but none of them provides an actual solution that has worked for this ridiculous problem I'm having. I'm simply trying to delete a folder from my backup drive in Windows 7, but Windows shows the error, "Destination Path Too Long: The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path. " as shown here: Then, after I "Skip" this item, I get another similar error, but this time it says, "Source Path Too Long: The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation. " as shown here: So, I deleted all sub folders and files in an attempt to work around this problem. There is one folder, that is actually completely empty, that refuses to be deleted. I moved this folder to the root of my drive, I even tried renaming it, but it never gets deleted. Seriously, I just want to delete this folder. I've tried third-party utilities, checked the disk for errors, tried deleting the folder from the command line, and nothing has been able to delete this folder. It seems like a cutting-edge operating system should be able to handle a simple delete operation without so much trouble. Brian Hall www.bhall.com try www.longPathTool.com
December 16th, 2010 8:24am

i also have faced the same problme and following software sort out my problem www.longPathTool.com some of the features of this softwares are: Path too long. Error cannot delete file: cannot read from source file or disk. Cannot delete file: Access is denied. There has been a sharing violation. Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name. The source or destination file may be in use. The file is in use by another program or user. Error Deleting File or Folder Make sure the disk is not full or write-protected and that the file is not currently in use. Path too deep.
Free Windows Admin Tool Kit Click here and download it now
January 3rd, 2011 8:15am

Hi. I had the same problem but with netbeans which built recursive folders with the root given name. I used the name “mermelada” under my c:\temp\ folder. I had thousands (at least) of c:\temp\mermelada\mermelada…. And so and not able to delete because the windows “name too long” message. I used the inspiration of another user of this issue and made a recupera2.bat with the following content ren c:\temp\mermelada\mermelada\mermelada x move c:\temp\mermelada\mermelada\x c:\temp\mermelada rd c:\temp\mermelada\mermelada ren c:\temp\mermelada\x mermelada recupera2.bat In a DOS window, I ran c:\recupera2.bat, leaved alone for 2 minutes and voila!... just a empty “mermalada” folder ready to be destroyed. Good luck!
January 20th, 2011 4:47pm

hi, had this issue too... My eclipse, went nuts when i opened work bench and made a huge folder tree.. the problem was that folders were in this order /uge4/src/uge4/src.... So from the post above I used the bat idea. looked like this... ren C:\Users\Jacob\Desktop\Java\prog2\Uge4 x ren C:\Users\Jacob\Desktop\Java\prog2\src x move C:\Users\Jacob\Desktop\Java\prog2\x\src C:\Users\Jacob\Desktop\Java\prog2\ move C:\Users\Jacob\Desktop\Java\prog2\x\Uge4 C:\Users\Jacob\Desktop\Java\prog2\ rd C:\Users\Jacob\Desktop\Java\prog2\x /s /q test.bat renaming the folder(s) and removing them.. used /s to remove any subfolders and /q to ignore query for (Y/N). And ignored the error messages ^^ had i running for some time and done :) //Rayf
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2011 7:25am

If robocopy was the cause of this problem as was in my case you can simply add an exclude parameter to the robocopy command excluding the problem directory (i.e. /XD e:\directory) and make sure to also include the /purge and /e parameters (or the /MIR parameter which appears to be the same). Robocopy can then clean up the mess it created (that YOU and I told it create). If robocopy wasn't the cause and you have a version of windows that supports robocopy than you could try making the destination directory of robocopy the problem directory and then use the above parameters.
February 8th, 2011 11:46am

I like the robocopy option. You don't have to install anything. I created the replica of the folder on a different drive that was totally empty. Then ran robocopy with these params. robocopy D:\folder z:\folder /Purge /E /S /R:0 /W:0 and it ran through it and cleaned it up very nicely. Thanks ITLouis!
Free Windows Admin Tool Kit Click here and download it now
April 13th, 2011 2:37pm

At a command prompt, use "dir /x" to get the short name for the directory - then do an RMDIR /s on that.
April 25th, 2011 5:44pm

Thanks Ceasar! I've been recently having the same issue. I reinstalled windows 7, I just wanted to delete the "windows.old" file that it creates for you with all your previous files prior to reinstall. It eventually gave me the same msg "cant delete folder, dest path too long". But it also said the folder was empty. I tried your suggestion above & worked like a charm. Awesome! Chris
Free Windows Admin Tool Kit Click here and download it now
April 26th, 2011 11:00pm

FYI, I just had the same problem. I was successful simply moving the file with the long filename to the trashcan and deleting it! Worked great. And much quicker than anything else.
July 2nd, 2011 1:01pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics